<?php
namespace Admin\model;
use Think\Model;
use Think\Model\RelationModel;
class ArticleTagModel extends RelationModel
{
		    // 传递aid添加相关数据
	public function addData($aid,$tids)
	{
		foreach ($tids as $k => $v) {
			$tag_data = array(
				'aid' => $aid,
				'tid' => $v
			);
			$this->add($tag_data);
		}
		return true;
	}

	    // 传递aid删除相关数据
	public function deleteData($aid){
		$this->where(array('aid'=>$aid))->delete();
		return true;
	}
	    // 传递aid查询相关数据
	public function getDataByAid($aid){
		return $this->where(array('aid'=>$aid))
		->getField('tid',true);
	}
}